import request from './index'

// 上传评论图片
export const uploadCommentImage = (file) => {
  const formData = new FormData()
  formData.append('file', file)
  return request.post('/comment/upload/comment', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 添加评论
export const addComment = (data) => {
  return request.post('/comment/add', data)
}

// 删除评论
export const deleteComment = (id) => {
  return request.delete('/comment/delete', { params: { id } })
}

// 修改评论
export const updateComment = (data) => {
  return request.post('/comment/update', data)
}

// 获取我的评论列表
export const getMyCommentList = () => {
  return request.get('/comment/myList')
}

// 获取评论列表
export const getCommentList = (data) => {
  return request.get('/comment/list', { params: data })
}

// 根据订单id查询评论
export const getCommentByOrderId = (orderId) => {
  return request.get(`/comment/get/${orderId}`)
} 